<?php

class Logs_model extends CI_Model {

    /**
     * Constructor
     */
    function __construct() {
        parent::__construct();
    }

    function _login() {
        $ress = $this->db->query("select a.*, b.username, b.path_image, b.insert_date from action_logs a left join m_user b on(a.username = b.username) where a.action = 'login' order by a.id DESC LIMIT 0,10")->result_array();
        return $ress;
    }
    
    function _record() {
        $ress = $this->db->query("select a.*, b.username, b.path_image, b.insert_date, c.title, c.artist, c.path_thumbnail from (action_logs a left join m_user b on(a.username = b.username)) left join m_song c on (a.id_song = c.id) where a.action = 'record' order by a.id DESC LIMIT 0,10")->result_array();
        return $ress;
    }
    
    function _play() {
        $ress = $this->db->query("select a.*, b.username, b.path_image, b.insert_date, c.title, c.artist, c.path_thumbnail from (action_logs a left join m_user b on(a.username = b.username)) left join m_song c on (a.id_song = c.id) where a.action = 'sing' OR a.action = 'watch' order by a.id DESC LIMIT 0,10")->result_array();
        return $ress;
    }

  
}

